gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\datasets\checkdat.m
function [result]=checkdat(fname,ident,Nmask,Kmask) % CHECKDAT checks data format of given file. % [result]=checkdat(fname,ident,Nmask,Kmask) % % CHECKDAT checks if the file has the internal toolbox representation % and complains to the data type determined by the input arguments. % % Input: % fname [string] name of the file which is to be checked. % % Following arguments are optional: % ident [string] data type identifier, see help dataid. % Nmask [1x1] data dimension. % Kmask [1xK] class sizes. % % Output: % result [1x1] is 1 if file has internal toolbox representation and % complains to the data type determined arguments else it returns 0. % % See DATAFILES. % % Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac % (c) Czech Technical University Prague, http://cmp.felk.cvut.cz % Written Vojtech Franc (diploma thesis) 02.01.2000 % Modifications % 26-June-2001, V.Franc, comments repared. % 24. 6.00 V. Hlavac, comments polished. % 9-jan-2001, the comments extended % supported data files: FINITE_SETS=1; NORMAL_DISTRIB=2; % load file load(fname); agree=0; % check mandatory variables if exist('id')==1 & exist('I')==1 & exist('K')==1 & exist('N')==1, agree=1; % check input N dimension if (Nmask>0 & Nmask~=N) agree=0; end % check identifier if strcmpi(ident,id)~=1, agree=0; end % check Kmask and current K if ~(max(size(Kmask)) == 1 & Kmask==0), if max(size(Kmask))==max(size(K)) & min(size(Kmask)) == min(size(K)), i=0; while agree==1 & i < max(size(Kmask)), i=i+1; if Kmask(i)~=0 & Kmask(i)~=K(i), agree=0; end end % while else agree=0; end end % sum(Kmask) > 0, % if agree is still one than chek variables depending on current % ident(ifier) if agree==1, if strcmpi(ident,dataid(FINITE_SETS))==1, % finite sets, enumerated, must contain var. X with points if exist('X')==0, agree=0; end elseif strcmpi(ident,dataid(NORMAL_DISTRIB))==1, % normal distributions, must contain vars. MI and SIGMA if exist('MI')==0 | exist('SIGMA')==0, agree=0; end else agree=0; end % elseif strcmpi(.. end % if agree==1, end % if exist('id')==1 & exist('I')==1 &... % set result result=agree;